package com.ndp.fb.enums.feed;

import java.util.ArrayList;
import java.util.List;

/**
 *
 Whether or not the item is in stock. Accepted values are:
 in stock - Item will ship immediately.
 out of stock - No plan to restock.
 preorder- Will be available in future.
 available for order - Ships in 1-2 weeks.
 * Created by hunk.qin on 2016/4/20.
 */
public enum Availability {

    inStock("in stock"),
    outOfStock("out of stock"),
    preorder("preorder"),
    availableForOrder("available for order"),
    discontinued("discontinued");

    private  String value;
    Availability(String value){
        this.value=value;
    }

    public static List<String> getValues(){
        ArrayList<String> list=new ArrayList<>();
        for (Availability availability : Availability.values()) {
            list.add(availability.value);
        }
        return list;
    }

    public static boolean contain(String value){
        for (Availability availability : Availability.values()) {
            if (availability.value.equals(value)) {
                return true;
            }
        }
        return false;
    }
}
